package com.mybook.app.controller;

import com.mybook.app.core.BaseResponse;
import com.mybook.app.request.CommentAddRequest;
import com.mybook.app.request.CommentPeopleRequest;
import com.mybook.app.request.CommentRequest;
import com.mybook.app.service.CommentService;
import com.mybook.app.utils.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zjutsw on 2017/11/8.
 */
@RestController
@RequestMapping("comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @PostMapping("add")
    public BaseResponse add(@RequestBody CommentAddRequest commentAddRequest) {
        Logger.debug(this, "添加评论");
        commentService.add(commentAddRequest);
        return BaseResponse.ok();
    }


    @PostMapping("book")
    public BaseResponse book(@RequestBody CommentRequest commentRequest) {
        Logger.debug(this, "获取评论 :" + commentRequest);
        return commentService.book(commentRequest);
    }

    @PostMapping("people")
    public BaseResponse people(@RequestBody CommentPeopleRequest commentPeopleRequest) {
        Logger.debug(this, "对流转人的评论 :" + commentPeopleRequest);
        commentService.people(commentPeopleRequest);
        return BaseResponse.ok();
    }


}
